<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ page import="com.yaodian100.core.common.utils.ServerValue"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<c-rt:set var="frontContextPath" value='<%=ServerValue.getFrontContextPath()%>'/>
<html>
<head>
<link rel="stylesheet" href="/css/xunlei.css" type="text/css" media="screen" />
<link rel="stylesheet" href="/css/yaodian100_reg_v2.css" type="text/css" />
<link rel="stylesheet" href="/css/yaodian100_header_v5.css" type="text/css" />
<link rel="stylesheet" href="/css/yaodian100_footer_v3.css" type="text/css" />
<link rel="stylesheet" href="/css/mgm_111128.css" type="text/css" />
<script src="http://rest.kaixin001.com/api/FeatureLoader_js.php" type="text/javascript"></script>
<script type="text/javascript" charset="UTF-8" src="/js/kaixin.js"></script>
<script language="javascript">
	var frontContextPath = '${frontContextPath}';
	$().ready(function(){

		$("#change_to_nonmember_dialog").dialog({
			autoOpen: false,
			bgiframe: true,
			width:300,
			height:160,
			modal: true
		});

		//xunlei
		$("#xunleiDialog").dialog({
			bgiframe: true,
			autoOpen: false,
			width:370,
			height:370,
			modal: true
		});
		
		$("#loginIDTip").hide();
		$("#pwdTip").hide();
		$("#codeTip").hide();
		<c:if test="${errTimes>3}">
		$("#iv").attr("src","${frontContextPath}/servlet/imageValid.jpg?"+Math.random());
		$("#chang_image").click(function(){
			$("#iv").attr("src","${frontContextPath}/servlet/imageValid.jpg?"+Math.random());
		});
		</c:if>
		<c:if test="${xerrTimes>3}">
		$("#xiv").attr("src","${frontContextPath}/servlet/imageValid.jpg?"+Math.random());
		$("#xchang_image").click(function(){
			$("#xiv").attr("src","${frontContextPath}/servlet/imageValid.jpg?"+Math.random());
		});
		</c:if>
		if("${nickId}"!=""){
			$("#remember").attr("checked", true);
		}
		
		$("#loginID").focus(function(){
			if($("#loginID").val()=='帐户名/手机/邮箱'){
			$("#loginID").val("").css("color","#000");}
			$("#loginID").attr('class','focus-ipt ipt-w20');
		}).blur(function(){
			if($("#loginID").val()==''){
			$("#loginID").val("帐户名/手机/邮箱").css("color","#aaa");}
			$("#loginID").attr('class','ipt-w20');
		});

		if($("#loginID").val()==''){
			$("#loginID").val("帐户名/手机/邮箱").css("color","#aaa")
		}

		$("#pwd").focus(function(){
			$("#pwd").attr('class','focus-ipt ipt-w20');
		}).blur(function(){
			$("#pwd").attr('class','ipt-w20');
		});

		$("#ccode").focus(function(){
			$("#ccode").attr('class','focus-ipt ipt-w20');
		}).blur(function(){
			$("#ccode").attr('class','ipt-w20');
		});
		
		if("${loginresult}" == "code_error"){
			$("#codeTip").html('验证码错误，请重新输入');
			$("#codeTip").show();
		}else if("${loginresult}" == "pwd_error"){
			$("#pwdTip").html('密码错误');
			$("#pwdTip").show();
		}else if("${loginresult}" == "unfind"){
			$("#loginIDTip").html('帐号不存在');
			$("#loginIDTip").show();
		}else if("${loginresult}" == "lock"){
			$("#loginIDTip").html('帐号已锁定');
			$("#loginIDTip").show();
		}else if("${loginresult}" == "not_active"){
			$("#loginIDTip").html('帐号未启用');
			$("#loginIDTip").show();
		}else if("${loginresult}" == "nonmember"){
			$("#change_to_nonmember_dialog").dialog('open');
		}else if("${loginresult}" == "xunleiError"){
			$("#xPwdTip").html('登入失败');
			$("#xPwdTip").show();
			$("#xunleiDialog").dialog('open');
			$("#xLoginID").blur();
		}else if("${loginresult}" == "xunlei_code_error"){
			$("#xcodeTip").html('验证码错误');
			$("#xcodeTip").show();
			$("#xunleiDialog").dialog('open');
			$("#xLoginID").blur();
		}

		$("#to_nonmember_dialog_close").click(function(){
			$("#change_to_nonmember_dialog").dialog('close');
		});
		
		$("#submit_data").click(function(){submitData();});		

		$("#loginID").keypress(function(e){pressEnter(e.keyCode)});
		$("#pwd").keypress(function(e){pressEnter(e.keyCode)});
		$("#ccode").keypress(function(e){pressEnter(e.keyCode)});
		$("#remember").keypress(function(e){pressEnter(e.keyCode)});

		//xunlei
		$("#xunleiLogin").click(function(){
			$("#xunleiDialog").dialog('open');
			$("#xLoginID").blur();
		});

		$("#xLoginID").focus(function(){
			if($("#xLoginID").val()=='迅雷号码/邮箱/手机号码'){
			$("#xLoginID").val("").css("color","#000");}
			$("#xLoginID").attr('class','tx_ipt2');
		}).blur(function(){
			if($("#xLoginID").val()==''){
			$("#xLoginID").val("迅雷号码/邮箱/手机号码").css("color","#aaa");}
			$("#xLoginID").attr('class','tx_ipt');
		});

		$("#xunlei_login").click(function(){xsubmitData();});	
		$("#xLoginID").keypress(function(e){xpressEnter(e.keyCode)});
		$("#xPwd").keypress(function(e){xpressEnter(e.keyCode)});
		<c:if test="${xerrTimes>3}">
		$("#xccode").keypress(function(e){xpressEnter(e.keyCode)});	
		</c:if>
	});

	function pressEnter(keycode){
		if(keycode == 13){
			submitData();
		}
	}

	function xpressEnter(keycode){
		if(keycode == 13){
			xsubmitData();
		}
	}
	
	function submitData(){
		var isCorrect = true;

		//clear tips
		$("#loginIDTip").hide();
		$("#pwdTip").hide();
		$("#codeTip").hide();

		$("#loginID").val(jQuery.trim($("#loginID").val()).toLowerCase());
		if(($("#loginID").attr('value') == "")||$("#loginID").val()=='帐户名/手机/邮箱'){
			$("#loginIDTip").html('请输入帐户名');
			$("#loginIDTip").show();
			isCorrect = false;
			return;
		}

		if(($("#pwd").attr('value') == "")){
			$("#pwdTip").html('请输入密码');
			$("#pwdTip").show();
			isCorrect = false;
			return;
		}
		<c:if test="${errTimes>3}">	
		if(($("#ccode").attr('value') == "")){
			$("#codeTip").html('请输入校验码');
			$("#codeTip").show();
			isCorrect = false;
			return;
		}
		</c:if>
		if(isCorrect){
			$("#memberForm").submit();
		}
		return false;
	}

	function xsubmitData(){
		var isCorrect = true;
		//clear tips
		$("#xLoginIDTip").hide();
		$("#xPwdTip").hide();

		$("#xLoginID").val(jQuery.trim($("#xLoginID").val()).toLowerCase());
		if(($("#xLoginID").attr('value') == "")||$("#xLoginID").val()=='迅雷号码/邮箱/手机号码'){
			$("#xLoginIDTip").html('请输入帐户名');
			$("#xLoginIDTip").show();
			isCorrect = false;
			return false;
		} 

		if(($("#xPwd").attr('value') == "")){
			$("#xPwdTip").html('请输入密码');
			$("#xPwdTip").show();
			isCorrect = false;
			return false;
		}
		<c:if test="${xerrTimes>3}">	
		if(($("#xccode").attr('value') == "")){
			$("#xcodeTip").html('请输入校验码');
			$("#xcodeTip").show();
			isCorrect = false;
			return false;
		}
		</c:if>
		if(isCorrect){
			$("#xunleiForm").submit();
		}
		return false;
	}
</script>
</head>
<body>
<%
String uri = request.getParameter("redirect_url");
String from = "yaodian100";
if(request.getCookies()!=null) {
for(Cookie c:request.getCookies()) {
	if("_from".equals(c.getName())) {
		from = c.getValue();
	}
}}

if("taobao".equals(from) || "taobao".equals(request.getAttribute("_from"))) {
%>
<script>
window.location.href='http://login.taobao.com/member/login.jhtml?f=top&redirectURL=http%3A%2F%2Fcontainer.api.taobao.com%2Fcontainer%3Fappkey%3D12156713%26redirectURL%3Dhttp%253A%252F%252Fwww.yaodian100.com%252Fecmall%252Ftologin.do%253Fredirect_url%253Dhttp%25253A%25252F%25252Fwww.yaodian100.com%25252Fecmall%25252Fmember%25252Fmyyaodian.do%25253Fhpp%25253DItpbar_1';
</script>
<% } %>
  <div id="header" class="mgm">
<div class="login-area">
<p id="notlogin" style="display:none;"><a href="javascript:;" id="tologin">登录</a></p>
<p id="islogin" style="display:none;">您好，<a href="/ecmall/member/myyaodian.do?hpp=Itpbar_1"><strong id="slid"></strong></a>&nbsp;<a href="javascript:;" id="tologout">退出</a></p>

</div>
    <div class="logo-area"><a href="/" class="logo" title="耀点100"><img src="/images/logo.gif" alt="耀点100" /></a></div>
  <div id="main" class="member-log">
      <div class="m-login-new"><strong>还不是耀点100会员?</strong> <a href="${frontContextPath}/toreg.do">立即注册</a></div>
      <div class="m-login-others">
         <strong>其他登录方式：</strong>
         <a href="${frontContextPath}/alipay/toAlipayLogin.do?redirect_url=${pathparamURLEncode}"><b class="alipay">&nbsp;</b>支付宝快捷登录</a>
         <a href="javascript:;" id="xunleiLogin"><b class="xl">&nbsp;</b>迅雷登录</a>
         <a id="kx001_btn_login"><b class="kaixin">&nbsp;</b>开心网登录</a>
         <a href="${frontContextPath}/toqqlogin.do?redirect_url=${pathparamURLEncode}"><b class="QQ">&nbsp;</b>QQ登录</a>
         <a href="${frontContextPath}/oauth360/toOauth360Login.do?redirect_url=${pathparamURLEncode}"><b class="login-360">&nbsp;</b>360登录</a>
         <a href="${frontContextPath}/tosinalogin.do"><b class="sina-weibo">&nbsp;</b>新浪微博登录</a>
      </div>
      <script type="text/javascript">KX001.init("445927298460e819d51962ce00342e69", "${frontContextPath}/common/kx001_receiver.html","<b class='kaixin'>&nbsp;</b>开心网登录","",1);</script>
	  <s:form action="login.do" method="post" id="memberForm">
      <div class="m-login">
        <h1>登录</h1>
            <ul>
              <li><div><label>帐户名：</label></div><div><input type="text" name="loginID" id="loginID" value="${loginID}" maxlength="100" class="ipt-w20" tabindex="1"/><br /><span id="loginIDTip" class="msg rn" style="display:none">请输入帐户名</span></div></li>
              <li><div><label>密<span class="w-L-1">码</span>：</label></div><div><input type="password" name="pwd" id="pwd" maxlength="16" class="ipt-w20" tabindex="2"/><br /><a href="<%=ServerValue.getFrontHostname()+ServerValue.getFrontContextPath()%>/forgetpwd.do">忘记密码？</a><br /><span id="pwdTip" class="msg rn" style="display:none">请输入密码</span></div></li>
              <c:if test="${errTimes>3}">
              <li><div><label>验证码：</label></div><div><input type="text" name="ccode" id="ccode" class="ipt-w20" autocomplete="off" tabindex="3"/><br />
                <span style="display:block"><span id="codeTip" class="msg rn" style="display:none">请输入校验码</span></span>
                <img id="iv" name="iv"> <a href="#" id="chang_image">换张图</a></div>
              </li>
              </c:if>
              <div class="remember-me"><input type="checkbox" id="remember" name="remember" tabindex="4"/>  记住帐户名</div> 
            </ul>
            <input type="hidden" name="errTimes" value='${errTimes}' />
            <input type="hidden" name="pathparam" id="pathparam" value='${pathparam}' />
            <p align="center" class="c-f"><a href="###" id="submit_data" class="btn-mid">登录</a></p>
            <div class="nomember-login">非会员<a href="${frontContextPath}/nonMember/tologin.do?redirect_url=<c:if test="${fn:contains(pathparam,'orderBuyNow.do') == false}">${pathparam}</c:if>">点此</a>登录</div>
      </div>
      </s:form>
     </div> 
     
<div id="change_to_nonmember_dialog" title="非会员登录" class="alert" style="display:none;">
<p>很抱歉，您还不是正式会员，<br />请从「非会员登录」进入。</p>
<div align="center"><span style="text-align:center;"><a href="<%=ServerValue.getFrontHostname()+ServerValue.getFrontContextPath()%>/nonMember/tologin.do?redirect_url=<c:if test="${fn:contains(pathparam,'orderBuyNow.do') == false}">${pathparam}</c:if>" class="btn-mid-8">非会员登录</a> <a href="javascript:;" id="to_nonmember_dialog_close" class="btn-mid">关闭</a></span></div>
</div>
<div id="xunleiDialog" title="迅雷登录" style="display:none;">
<div class="loginbox">
    	<h2>登录</h2>
        <div class="content">	
        <s:form action="xunleiLogin.do" method="post" id="xunleiForm">	
        	<ul class="loginform" style="display:block">
                <li>
					<label>迅雷帐号：</label>
					<input id="xLoginID" name="xloginID" type="text" value="${xloginID}" class="tx_ipt" maxlength="50"/>
					<span style="display:block"><span class="msg rnx" style="display:none;" id="xLoginIDTip"></span></span>
                </li>
                <li>
					<label>迅雷密码：</label>
					<input id="xPwd" name="pwd" type="password" class="tx_ipt" maxlength="16"/>
					<span style="display:block"><span class="msg rnx" style="display:none;" id="xPwdTip"></span></span>
					<input type="hidden" name="xerrTimes" value='${xerrTimes}' />
					<input type="hidden" name="pathparam" id="pathparam" value='${pathparam}' />
                </li>
                <c:if test="${xerrTimes>3}">	
                <li>
					<label>&nbsp;&nbsp;&nbsp;验证码：</label>
					<input type="text" name="ccode" id="xccode" autocomplete="off" maxLength="6"/><br/>
					<span style="display:block"><span id="xcodeTip" class="msg rnx" style="display:none">请输入校验码</span></span>
				</li>
				<li><div class="divnum"><span class="type-3 txt-L"><img id="xiv" alt="验证码" /></span><br/><span><a href="javascript:;" id="xchang_image">换张图</a></span></div></li>  
				</c:if> 
                <li class="li_b"><button id="xunlei_login" class="btn_in2">登 录</button></li>
                <li>＊ 如忘记迅雷帐号或密码，请返回迅雷网站查询。</li>
        	</ul>
        </s:form>
        </div>
    </div>
    </div>
</div>
</body>
</html>